import { Field, Int, ObjectType } from "@nestjs/graphql";
import { BaseEntity } from "./baseEntity";
import { Order } from "@prisma/client";
import { ShopEntity } from "./shop.entity";
import { UserEntity } from "./user.entity";
import { OrderOnGoodsEntity } from "./order-goods.entity";




@ObjectType()
export class OrderEntity extends BaseEntity implements Order {
    @Field(()=>Int)
    responsibleOrderId: number;
    
    @Field()
    status: string;

    @Field(() => Int)
    userId: number;

    @Field(() => UserEntity, { nullable: true })
    user?: UserEntity

    @Field({ nullable: true })
    payTime: Date;

    @Field(() => Int)
    shopId: number;

    @Field(() => ShopEntity, { nullable: true })
    shop: ShopEntity

    @Field(() => [OrderOnGoodsEntity], { nullable: true })
    OrderOnGoods?: OrderOnGoodsEntity[]
}